package wzh000;

//import com.google.*;
import com.google.gson.Gson;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;





public class DiscardCardsRequest {
	private String cmd;
	
	//private Map<Map<Integer, String>, Map<String, String>> cards;
	private List<ArrayList<Object>> cards;
	private boolean last_cards;
	
	public DiscardCardsRequest(String msg, boolean lastCard){
		this.cmd = msg;
		this.last_cards = lastCard;
		this.cards = new ArrayList<ArrayList<Object>>();
		//this.cards = new HashMap<Map<Integer, String>, Map<String, String>>();
	}
	//{"cmd":"discard","cards":{"[6, spades]":["6","diamonds"]},"last_cards":false}
	//{"cmd":"discard","cards":[[5,"dame"],[6,"dame"]],"last_cards":false}
	public void fillinCards(Card removedCard, Card card){
		/*
		Map<Integer, String> a = new HashMap<Integer, String>();
		a.put(Integer.parseInt(removedCard.getValue()), removedCard.getType());

		Map<String, String> b = new HashMap<String, String>();
		b.put(card.getValue(), card.getType());
		
		this.cards.put(a, b);
		*/
		ArrayList<Object> a = new ArrayList<Object>();
		a.add(Integer.parseInt(removedCard.getValue()));
		a.add(removedCard.getType());
		ArrayList<Object> b = new ArrayList<Object>();
		b.add(Integer.parseInt(card.getValue()));
		b.add(card.getType());
		this.cards.add(a);
		this.cards.add(b);
		
	}
	
	public static void main(String[] args) {
		
		Card card_a = new Card();
		card_a.setValue("3");
		card_a.setType("spades");
		
		Card card_b = new Card();
		card_b.setValue("3");
		card_b.setType("clubs");
		
		//boolean aaa = isInteger(card_a.getValue());
		//boolean bbb = isInteger(card_b.getValue());
		
		
		
		
		List<String> aa = new ArrayList<String>();
		
		DiscardCardsRequest a = new DiscardCardsRequest("discard", false);
		
		
		a.fillinCards(card_a, card_b);
		
		
		
		/*
		aa.add(card_a.getValue());
		aa.add(card_a.getType());
		List<String> b = new ArrayList<String>();
		b.add(card_b.getValue());
		b.add(card_b.getType());
		*/
		Gson gson = new Gson();
		String json = gson.toJson(a);
		System.out.println(json);
		
	}
	
}




